// src/pages/Env/index.tsx
import { listComposes } from '@/services/container/ContainerManagerController';
import { PageContainer } from '@ant-design/pro-components';
import React, { useEffect, useState } from 'react';
import ContainerManager from '@/components/ContainerManager';

const EnvPage: React.FC = () => {
  const [composes, setComposes] = useState<API.DockerComposeVO[]>([]);
  const [loading, setLoading] = useState<boolean>(true);

  useEffect(() => {
    const fetchData = async () => {
      const result = await listComposes('base');
      if (result.success) {
        setComposes(result.data || []);
      }
      setLoading(false);
    };

    fetchData();
  }, []);

  return (
      <PageContainer ghost header={{ title: '环境应用' }}>
        <ContainerManager
            composes={composes}
            loading={loading}
            type="base"
        />
      </PageContainer>
  );
};

export default EnvPage;
